

let params = new URLSearchParams(window.location.search);
var posId = params.get('posId');

var jrId ;
// console.log(jrId)
console.log("=params=")
console.log(params.get("posId"))
console.log(params.get("jrId"))

$(function (){

console.log("页面加载就走")
    $.ajax({
        headers:{
            "id":localStorage.getItem("id"),
            "token":localStorage.getItem("token")
        },
        url:`/dev/Ranking/hits/${posId}`,
        type:"get",
        success: function (result) {
            console.log("添加成功")
        }
    })

    // let postId = localStorage.getItem("postId")
    // localStorage.removeItem("postId")
    console.log("===id===")
    console.log(localStorage.getItem("id"))
    console.log(localStorage.getItem("token"))
    $.ajax({
        headers:{
            "id": localStorage.getItem("id"),
            "token": localStorage.getItem("token")
        },
        type: 'get',
        url: `/dev/Details/postId/${posId}`,
        async: false,
        success:function (result) {
            console.log(result);
            jrId = result.data.jrId;

            $("#posName").text(result.data.posName)
            $("#pay").text(Math.round(eval(result.data.payFloor / 1000)) + "K-" + Math.round(eval(result.data.payUpper / 1000)) + "K")
            $("#workPlace").text(result.data.workPlace)
            $("#expDemand").text(result.data.expDemand)
            $("#background").text(result.data.background)
            //java--关键词
            let str = ""
            for (let i = 0; i < 4; i++) {
                str += `<li>${result.data.posKeyword}</li>`
            }
            $("#posKeywords").html(str)

            $("#posDescription").text(result.data.posDescription)
            //负责人，--刚刚活跃
            $("#jrName").text(result.data.jrName)

            $("#companyNames").text(result.data.companyName)
            //下方--公司介绍
            $("#companyIntro").text(result.data.companyIntro)
            // 右侧相似职位下的
            $("#posNames").text(result.data.posName)
            $("#pays").text(Math.round(eval(result.data.payFloor/1000))+"K-"+Math.round(eval(result.data.payUpper/1000))+"K")
            $("#companyName1").text(result.data.companyName)
            $("#workPlaces").text(result.data.workPlace)
            $("#companyIntro").text(result.data.companyIntro)

            //右侧公司基本信息
            $("#company-name").text(result.data.companyName)
            $("#postType").text(result.data.posType)
            $("#employees").text(result.data.employeesQuantity)

            $("#jrType").text(result.data.jrType)
            // $("#jrAvatar").text(result.data.jrAvatar)

            console.log(result.data.jrAvatar)
            console.log(document.getElementById("jrAvatar").children)
            document.getElementById("jrAvatar").children[0].src=result.data.jrAvatar

            //公司名称
            $("#companyName").text(result.data.companyName)
            //法定代表人
            $("#legalPerson").text(result.data.legalPerson)
            //经营状态
            $("#runState").text(result.data.runState)
            //成立时间
            $("#SetUpTime").text(result.data.setUpTime)
            //企业类型
            $("#companyType").text(result.data.companyType)
            //注册资金

            //地图--工作地址
            $("#workPlace1").text(result.data.workPlace)

        }
    })

})

function details(){

    window.location.href=`/dev/views/job/page/jobdetails.html?jrId=${jrId}`
}
function views(){

    window.location.href=`/dev/views/job/page/jobdetails.html?jrId=${jrId}`
}


